package org.openlab.service.impl;

import java.util.List;
import java.util.Map;

import org.openlab.dao.ExchangeMappingDao;
import org.openlab.model.ExchangeMapping;
import org.openlab.service.ExchangeMappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.common.collect.Maps;

@Service
public class ExchangeMappingServiceImpl extends BaseServiceImpl<ExchangeMapping, Long> implements ExchangeMappingService {

	@Autowired
	public ExchangeMappingServiceImpl(ExchangeMappingDao dao) {
		super(dao);
	}

	@Override
	public ExchangeMapping getByExId(String exId) {
		Map<String, ExchangeMapping> exLookup = Maps.uniqueIndex(dao.getAll(), ExchangeMapping.FUNCTION_EXID);
		return exLookup.get(exId);
	}
	
}
